package file;


//使用base64进行编码解码
import java.util.Arrays;
import java.util.Base64;

public class base64  {
    public static void main(String[] args) {
       Base64.Encoder base =  Base64.getEncoder();
       String str = "我是大象大象我是大象大象我是大象大象我是大象大象";
        byte[] b = str.getBytes();
        System.out.println("编码前="+Arrays.toString(b));
        byte[] enoder = base.encode(b);
        System.out.println("编码="+Arrays.toString(enoder));
        Base64.Decoder Decoder = Base64.getDecoder();
        byte[] d = Decoder.decode(enoder);
        String s = new String(d);
        System.out.println("解码="+s);
    }
}
